import request from '@/utils/axios';
import { attendance } from '@/config/env'; 


export const page = query => {
  return request({
    url: attendance + '/class/info/page',
    method: 'post',
    data: query,
  });
};

export const find = query => {
  return request({
    url: attendance + '/class/info/find',
    method: 'post',
    data: query,
  });
};

export const findById = id => {
  return request({
    url: attendance + '/class/info/' + id,
    method: 'get',
  });
};

export const save = model => {
  return request({
    url: attendance + '/class/info',
    method: 'post',
    data: model,
  });
};

export const edit = model => {
  return request({
    url: attendance + '/class/info/' + model.id,
    method: 'put',
    data: model,
  });
};

export const del = id => {
  return request({
    url: attendance + '/class/info/' + id,
    method: 'delete',
  });
};

export const batDel = ids => {
  return request({
    url: attendance + '/class/info',
    method: 'delete',
    data: ids,
  });
};

export const findByStaffId = query => {
  return request({
    url: attendance + '/class/info/staff/' + query.id,
    method: 'get',
    params: query.data,
  });
};

export const findClassInfo = query => {
  return request({
    url: attendance + '/class/info',
    method: 'get',
    params: query,
  });
};

export const findClassDetail = query => {
  return request({
    url: attendance + '/class/info/detail',
    method: 'get',
    params: query,
  });
};

export const arrange = query => {
  return request({
    url: attendance + '/class/info/arrange/' + query.type,
    method: 'post',
    data: query.data,
  });
};

export const findStaffByClassId = query => {
  return request({
    url: attendance + '/class/' + query.id + '/staff',
    method: 'post',
    data: query.data,
  });
};

export const batchRemoveClassStaff = ids => {
  return request({
    url: attendance + '/class/staff/remove',
    method: 'delete',
    data: ids,
  });
}

export const saveClassStaff = model => {
  return request({
    url: attendance + '/class/staff',
    method: 'post',
    data: model,
  });
}

export const removeClassInfo = id => {
  return request({
    url: attendance + '/class/info/remove/' + id,
    method: 'delete',
  });
}


export const pageStaffClass = query => {
  return request({
    url: attendance + '/staff/class/page',
    method: 'post',
    params: query.params,
    data: query.data,
  });
};

export const pageStaffWeek = query => {
  return request({
    url: attendance + '/staff/class/week',
    method: 'post',
    params: query.params,
    data: query.data,
  });
};

export const findClassByStaff = query => {
  return request({
    url: attendance + '/staff/' + query.id + '/class',
    method: 'get',
    params: query.params,
  });
};